package 比赛.jitiaojuesai;

import java.util.Scanner;

public class Test1 {
    private static  int res;
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N,M;
        N = sc.nextInt();
        M = sc.nextInt();
        int[] weight = new int[M];
        for (int i = 0; i < M; i++) {
            int temp = sc.nextInt();
            weight[i] = temp;
        }

        getRes(weight, N );
        System.out.println(res);

    }

    static void getRes(int[] weight, int N)
    {
        for (int i = 1; i < 1 << weight.length; i++)
        {
            int sum=0;
            for (int j = 0; j < weight.length; j++)
            {
                if ((i & 1 << j) != 0)
                {
                    sum += weight[j];
                }
            }
            if (sum == N) res++;
        }
    }
}



